package com.vhall.component.entity.interactive.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 问题回复表
 *
 * @author shenghua.luo
 */
@Data
@TableName("qa_answer")
public class AnswerEntity implements Serializable {

    private static final long serialVersionUID = 1597657623792L;

    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 问题id
     */
    @TableField("ques_id")
    @JsonProperty(value = "ques_id")
    @JSONField(name = "ques_id")
    private Long quesId;


    /**
     * 答案ID
     */
    @TableField("parent_id")
    @JsonProperty(value = "parent_id")
    @JSONField(name = "parent_id")
    private Long parentId;

    /**
     * 用户昵称
     */
    @TableField("nick_name")
    @JsonProperty(value = "nick_name")
    @JSONField(name = "nick_name")
    private String nickName;

    /**
     * 应用ID
     */
    @TableField("app_id")
    @JsonProperty(value = "app_id")
    @JSONField(name = "app_id")
    private String appId;

    /**
     * 活动ID
     */
    @TableField("room_id")
    @JsonProperty(value = "room_id")
    @JSONField(name = "room_id")
    private String roomId;

    /**
     * 提问用户头像
     */
    private String avatar;

    /**
     * 回复内容
     */
    private String content;

    /**
     * 是否公开 0私密 1公开
     */
    @TableField("is_open")
    @JsonProperty(value = "is_open")
    @JSONField(name = "is_open")
    private Integer isOpen;

    /**
     * 答复人id
     */
    @TableField("join_id")
    @JsonProperty(value = "join_id")
    @JSONField(name = "join_id")
    private Long joinId;

    /**
     * 0 表示未读，1 表示已读
     */
    private Integer status;

    /**
     * 回复类型 0文字 1语音
     */
    private Integer type;

    /**
     * 在活动中的角色，0:普通用户， 1：播主，2：管理员. 注意不是用户登陆时的角色
     */
    private Integer role;

    /**
     * 撤销
     */
    @TableField("is_backout")
    @JsonProperty(value = "is_backout")
    @JSONField(name = "is_backout")
    private Integer isBackout;

    /**
     * 点赞数
     */
    @TableField("favored_count")
    @JsonProperty(value = "favored_count")
    @JSONField(name = "favored_count")
    private Integer favoredCount;

    /**
     * 业务扩展字段
     */
    private String ext;

    /**
     * 创建时间
     */
    @TableField("created_at")
    @JsonProperty(value = "created_at")
    @JSONField(name = "created_at")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField("updated_at")
    @JsonProperty(value = "updated_at")
    @JSONField(name = "updated_at")
    private LocalDateTime updatedAt;

    /**
     * 删除时间
     */
    @TableField("deleted_at")
    @JsonProperty(value = "deleted_at")
    @JSONField(name = "deleted_at")
    private LocalDateTime deletedAt;

    @TableField(exist = false)
    @JSONField(name = "role_name")
    private String roleName;

    @TableField(exist = false)
    private List<AnswerEntity> children = Lists.newArrayList();


}
